export const rules = {
  ownerOrgObjID: {
    required: true,
    message: '请选择入库地点',
    trigger: 'change',
  },
  assetCodes: {
    required: true,
    message: '请选择入库设备',
    trigger: 'change',
  },
  orderFormObjID: {
    required: true,
    message: '请选择订单号',
    trigger: 'change',
  },
}

export interface InWarehouseForm {
  orderFormObjID: string
  assetCodes: string[]
  ownerOrgObjID: string
  remark: ''
}

export function useInitForm(): { formData: Ref<InWarehouseForm>, initForm: () => void } {
  const getData = (): InWarehouseForm => ({
    orderFormObjID: '',
    assetCodes: [],
    ownerOrgObjID: '',
    remark: '',
  })
  const formData = ref<InWarehouseForm>(getData())

  const initForm = () => {
    formData.value = getData()
  }

  return { formData, initForm }
}
